from pandas import DataFrame
from sqlalchemy import create_engine, text
import pandas as pd


def run(param_dict: dict) -> DataFrame:
    type = param_dict["type"]
    host = param_dict["host"]
    db = param_dict["db"]
    user = param_dict["user"]
    password = param_dict["password"]
    port = param_dict["port"]
    query = param_dict["query"]
    engine = create_engine('mysql+pymysql://%s:%s@%s:%s/%s?charset=utf8'
                       % (user, password, host, port, db))
    connection = engine.connect()
    # df = pd.read_sql(sql=text(query), con=connection)
    df = pd.read_sql_query(sql=text(query), con=connection)

    return df
